package com.example.team.controller;

import com.example.team.entity.SafetyEquipmentPurchaseDetails;
import com.example.team.service.ISafetyEquipmentPurchaseDetailsService;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * 编写者：蓝江富
 * 时间：2023年10月31日18:22:47
 */
@RestController
@Api(tags = "劳保订单明细")
public class SafetyEquipmentPurchaseDetailsController {
    @Autowired
    private ISafetyEquipmentPurchaseDetailsService safetyEquipmentPurchaseDetailsService;

    @ApiOperation(value = "添加劳保订单",
            notes = "成功返回1")
    @RequestMapping("/insertSafetyEquipmentPurchaseDetails")
    public int insertSafetyEquipmentPurchaseDetails(SafetyEquipmentPurchaseDetails safetyEquipmentPurchaseDetails){
        return safetyEquipmentPurchaseDetailsService.insertSafetyEquipmentPurchaseDetails(safetyEquipmentPurchaseDetails);
    }

    @ApiOperation(value = "删除劳保订单",
            notes = "成功返回1")
    @RequestMapping("/deleteSafetyEquipmentPurchaseDetails")
    public int deleteSafetyEquipmentPurchaseDetails(Integer id){
        SafetyEquipmentPurchaseDetails safetyEquipmentPurchaseDetails=new SafetyEquipmentPurchaseDetails();
        safetyEquipmentPurchaseDetails.setDetailsId(id);
        return safetyEquipmentPurchaseDetailsService.deleteSafetyEquipmentPurchaseDetails(safetyEquipmentPurchaseDetails);
    }

    @ApiOperation(value = "修改劳保订单信息",
            notes = "成功返回1")
    @RequestMapping("/updateSafetyEquipmentPurchaseDetails")
    public int updateSafetyEquipmentPurchaseDetails(SafetyEquipmentPurchaseDetails safetyEquipmentPurchaseDetails){
        return safetyEquipmentPurchaseDetailsService.updateSafetyEquipmentPurchaseDetails(safetyEquipmentPurchaseDetails);
    }

    @ApiOperation(value = "查询所有劳保订单信息",
            notes = "成功返回Json")
    @RequestMapping("/getAllSafetyEquipmentPurchaseDetails")
    public List<SafetyEquipmentPurchaseDetails> getAllSafetyEquipmentPurchaseDetails(Integer applicant){
        SafetyEquipmentPurchaseDetails safetyEquipmentPurchaseDetails=new SafetyEquipmentPurchaseDetails();
        safetyEquipmentPurchaseDetails.setApplicant(applicant);
        return safetyEquipmentPurchaseDetailsService.getAllSafetyEquipmentPurchaseDetails(safetyEquipmentPurchaseDetails);
    }

    @ApiOperation(value = "查询劳保订单信息",
            notes = "成功返回Json")
    @RequestMapping("/getSafetyEquipmentPurchaseDetails")
    public SafetyEquipmentPurchaseDetails getSafetyEquipmentPurchaseDetails(Integer applicant){
        SafetyEquipmentPurchaseDetails safetyEquipmentPurchaseDetails=new SafetyEquipmentPurchaseDetails();
        safetyEquipmentPurchaseDetails.setApplicant(applicant);
        return safetyEquipmentPurchaseDetailsService.getSafetyEquipmentPurchaseDetails(safetyEquipmentPurchaseDetails);
    }
}
